package com.link2room.aeriabots.controller.api;

import com.link2room.aeriabots.facade.IMemberFacadeService;
import com.link2room.common.dto.result.base.BaseResultDto;
import com.link2room.common.dto.result.base.MemberSessionDto;
import com.link2room.mirage.dto.param.WxLoginParamDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * 模拟openid登录
 * Created by LN on 2016/9/7.
 */
@Api(tags = {"模拟openid登录"})
@Controller
@RequestMapping("/api/mockOpenid")
public class MockOpenIDController {

    @Resource
    private IMemberFacadeService memberFacadeService;

    @ApiOperation(value="登录模拟", response =MemberSessionDto.class )
    @RequestMapping(method = RequestMethod.GET)
    public @ResponseBody
    BaseResultDto requestForOpenid() throws Exception {
        MemberSessionDto memberSessionDto ;//返回结果



        String openid = "this_is_mock_open_id";

        WxLoginParamDto rpd = new WxLoginParamDto();
        rpd.setOpenid(openid);
        //会员登录检测
        memberSessionDto = memberFacadeService.wxLogin(rpd);
        memberSessionDto.getTicket();
            /*wxRes.setTicket(memberSessionDto.getTicket());
            wxRes.setMobile(memberSessionDto.getMobile());
            wxRes.setSex(memberSessionDto.getSex());
            wxRes.setMemberName(memberSessionDto.getMemberName());*/
        BaseResultDto resultDto = new BaseResultDto();
        resultDto.setResultCode(0);
        resultDto.setResultInfo(memberSessionDto);
        return resultDto;
    }
}
